package com.tanhua.db.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.api.SoulQuestionApi;
import com.tanhua.db.mapper.SoulQuestionsMapper;
import com.tanhua.model.pojo.Question;
import com.tanhua.model.soul.SoulQuestions;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;

@DubboService
public class SoulQuestionApiImpl implements SoulQuestionApi {

    @Autowired
    private SoulQuestionsMapper soulQuestionsMapper;

    @Override
    public List<SoulQuestions> getAllQuestionById(Integer questionId) {
        LambdaQueryWrapper <SoulQuestions> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SoulQuestions::getQuestionPageId,questionId);
        List<SoulQuestions> soulQuestionsList = soulQuestionsMapper.selectList(wrapper);
        return soulQuestionsList;
    }

    @Override
    public SoulQuestions getById(String questionId) {
        return soulQuestionsMapper.selectById(Integer.valueOf(questionId));
    }
}
